package com.cnfilm.web.tags;

import java.util.List;

import com.cnfilm.utils.CacheManager;
import com.jfinal.plugin.activerecord.Model;

/**
 * Tags model.
 */
@SuppressWarnings("serial")
public class Tags extends Model<Tags> {
	
	public static final Tags dao = new Tags();
	
	@SuppressWarnings("unchecked")
	public static List<Tags> getAllTags(){
		String key = "cache_getAllTags";
		List<Tags> tList = null;
		boolean hasCache = CacheManager.hasCache(key);
		if (hasCache) {
			tList = (List<Tags>)CacheManager.getCache(key);
	    } else {
	    	tList = Tags.dao.find("select * from tags order by tid desc");
		    CacheManager.putCache(key, tList);  
	    }
		return tList;
	}
	
	public static List<Tags> getNoCacheAllTags(){
		List<Tags> tList = Tags.dao.find("select * from tags order by tid desc");
		return tList;
	}
	
}